home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / examples / initialize.lsp < prev    next >
Encoding:
Lisp/Scheme  |  1991-10-06  |  6.9 KB  |  182 lines

  1. ; -*-Lisp-*-
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;
  4. ; File:         .winterp
  5. ; RCS:          $Header: initialize.lsp,v 1.3 91/10/05 18:09:06 mayer Exp $
  6. ; Description:  WINTERP INITIALIZATION FILE
  7. ;        You should do the following:
  8. ;        (1) copy this file to <homedir>/.winterp
  9. ;        (2) set resource "Winterp.lispInitFile: <homedir>/.winterp"
  10. ;        (3) Customize sections commented out at the end of this file.
  11. ;            * Uncomment "LOAD" statements
  12. ;            * Add XLISP globals that one wants customized.
  13. ;            * Load any other personal macros, etc.
  14. ; Author:       Niels Mayer, HPLabs
  15. ; Created:      Mon Nov 20 18:13:23 1989
  16. ; Modified:     Sat Oct  5 18:08:19 1991 (Niels Mayer) mayer@hplnpm
  17. ; Language:     Lisp
  18. ; Package:      N/A
  19. ; Status:       X11r5 contrib tape release
  20. ;
  21. ; WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  22. ; XLISP version 2.1, Copyright (c) 1989, by David Betz.
  23. ;
  24. ; Permission to use, copy, modify, distribute, and sell this software and its
  25. ; documentation for any purpose is hereby granted without fee, provided that
  26. ; the above copyright notice appear in all copies and that both that
  27. ; copyright notice and this permission notice appear in supporting
  28. ; documentation, and that the name of Hewlett-Packard and Niels Mayer not be
  29. ; used in advertising or publicity pertaining to distribution of the software
  30. ; without specific, written prior permission.  Hewlett-Packard and Niels Mayer
  31. ; makes no representations about the suitability of this software for any
  32. ; purpose.  It is provided "as is" without express or implied warranty.
  33. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  34.  
  35. ; initialization file for XLISP 2.1 & WINTERP
  36.  
  37. ; define some macros
  38. (defmacro defvar (sym &optional val)
  39.   `(if (boundp ',sym) ,sym (setq ,sym ,val)))
  40. (defmacro defparameter (sym val)
  41.   `(setq ,sym ,val))
  42. (defmacro defconstant (sym val)
  43.   `(setq ,sym ,val))
  44.  
  45. ; (makunbound sym) - make a symbol value be unbound
  46. (defun makunbound (sym) (setf (symbol-value sym) '*unbound*) sym)
  47.  
  48. ; (fmakunbound sym) - make a symbol function be unbound
  49. (defun fmakunbound (sym) (setf (symbol-function sym) '*unbound*) sym)
  50.  
  51. ; (mapcan fun list [ list ]...)
  52. (defmacro mapcan (&rest args) `(apply #'nconc (mapcar ,@args)))
  53.  
  54. ; (mapcon fun list [ list ]...)
  55. (defmacro mapcon (&rest args) `(apply #'nconc (maplist ,@args)))
  56.  
  57. ; (set-macro-character ch fun [ tflag ])
  58. (defun set-macro-character (ch fun &optional tflag)
  59.     (setf (aref *readtable* (char-int ch))
  60.           (cons (if tflag :tmacro :nmacro) fun))
  61.     t)
  62.  
  63. ; (get-macro-character ch)
  64. (defun get-macro-character (ch)
  65.   (if (consp (aref *readtable* (char-int ch)))
  66.     (cdr (aref *readtable* (char-int ch)))
  67.     nil))
  68.  
  69. ; (savefun fun) - save a function definition to a file
  70. (defmacro savefun (fun)
  71.   `(let* ((fname (strcat (symbol-name ',fun) ".lsp"))
  72.           (fval (get-lambda-expression (symbol-function ',fun)))
  73.           (fp (open fname :direction :output)))
  74.      (cond (fp (print (cons (if (eq (car fval) 'lambda)
  75.                                 'defun
  76.                                 'defmacro)
  77.                             (cons ',fun (cdr fval))) fp)
  78.                (close fp)
  79.                fname)
  80.            (t nil))))
  81.  
  82. ; (debug) - enable debug breaks
  83. (defun debug ()
  84.        (setq *breakenable* t))
  85.  
  86. ; (nodebug) - disable debug breaks
  87. (defun nodebug ()
  88.        (setq *breakenable* nil))
  89.  
  90. (setq *breakenable* nil)        ; T allows entry into breakloop
  91. (setq *tracenable* t)            ; set this to T if you want to see a
  92.                     ; backtrace on error.
  93. (setq *gc-flag* t)            ; we want to see garbage collection messages
  94.  
  95.  
  96. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  97. ;; ***********   P E R S O N A L  C U S T O M I Z A T I O N S  ************ ;;
  98. ;;
  99. ;; Uncomment the following expressions in order to set up the appropriate
  100. ;; personal customization for WINTERP.
  101. ;;
  102. ;; Note that the load-filenames used below are correct if you set WINTERP
  103. ;; resource Winterp.lispLibDir: "<path>/winterp/examples/ 
  104. ;; (where <path> is the full path to wherever you've put the WINTERP dist.)
  105. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  106.  
  107.  
  108. ;;;
  109. ;;; set up editor used by "$EDITOR)" button in w_ctrlpnl.lsp, and grep-br.lsp
  110. ;;; If you don't set this then environment variable $EDITOR will be used.
  111. ;;;
  112.  
  113. ; ;; For those using Andy Norman's emacs gnuserv/gnuclient/gnudoit package...
  114. ; (setq *SYSTEM-EDITOR* "gnuclient -q")
  115. ;
  116. ; ;; For those using emacs' standard emacsserver/emacsclient package...
  117. ; (setq *SYSTEM-EDITOR* "emacsclient") 
  118. ;
  119. ; ;; VI users will want to use this, even though it is slow, but hey, you use VI, so you must be used to braindamage by now :-)...
  120. ; (setq *SYSTEM-EDITOR* "xterm -e vi") 
  121. ;
  122.  
  123.  
  124. ;;;
  125. ;;; Load the WINTERP control panel -- provides control over the XLISP debugger,
  126. ;;; alongside a file-browser and an XmText editor. The XmText editor may be
  127. ;;; used to for entering Lisp expressions into WINTERP's XLISP evaluator --
  128. ;;; the expression underneath the cursor is evaluated by using the
  129. ;;; "Eval @ Point" button. Note that the editor and Lisp evaluator portions
  130. ;;; of w_ctrlpnl.lsp need alot more work. I use gnu-emacs myself...
  131. ;;; (also, you should set *SYSTEM-EDITOR* first...)
  132. ;;;
  133.  
  134. ; (if (not (load "w_ctrlpnl"))        ;load doesn't signal an error.
  135. ;     (error "Couldn't load w_ctrlpnl.lsp -- did you forget to set\nresource .lispLibDir or command-line argument -lib_dir\nto specify the path to the WINTERP examples directory??")
  136. ;   )
  137.  
  138.  
  139. ;;; 
  140. ;;; Load "prov-req" providing XLISP routines PROVIDE and REQUIRE, which
  141. ;;; behave much like their counterparts in Common Lisp. REQUIRE is a much
  142. ;;; nicer way to load files than LOAD because it allows you to specify a 
  143. ;;; load path. Note that "prov-req" only work for X11r4/Motif1.1
  144. ;;;
  145. ;;; Set global variable *default-load-path* to a string whose format is
  146. ;;; described by the Xtoolkit function XtResolvePathname().
  147. ;;; (%N gets substituted for the name REQUIRE'd, %S=.lsp)
  148. ;;;
  149.  
  150. ; (setq *default-load-path*
  151. ;       (strcat
  152. ;        "/users/mayer/%N%S:"
  153. ;        "/users/mayer/%N:"
  154. ;        "/users/mayer/src/winterp/examples/%N%S:"
  155. ;        "/users/mayer/src/winterp/examples/%N:"
  156. ;        "/tmp/%N%S:"
  157. ;        "/tmp/%N"
  158. ;        ))
  159. ; (if (not (load "prov-req"))        ;load doesn't signal an error.
  160. ;     (error "Couldn't load prov-req.lsp -- did you forget to set\nresource .lispLibDir or command-line argument -lib_dir\nto specify the path to the WINTERP examples directory??")
  161. ;   )
  162.  
  163.  
  164. ;;;
  165. ;;; Add a method on the widget metaclass WIDGET_CLASS. The method allow use of
  166. ;;; simpler notation for doing XtGetValues() for a single resource.
  167. ;;; (send <widget-class> :get :<resource-name>) ==> returns the resource value.
  168. ;;;
  169.  
  170. ;(send WIDGET_CLASS :answer :get '(resource-name)
  171. ; '(
  172. ;   (car (send self :GET_VALUES resource-name NIL))
  173. ;   ))
  174.  
  175.  
  176. ;;;
  177. ;;; Set the grep program used by the Motif 1.1 version of grep-br.lsp
  178. ;;; gnugrep is highly recommended because it is many times faster than standard grep...
  179. ;;;
  180.  
  181. ; (setq *GREP-BR-EXECUTABLE* "gnugrep")
  182.